package com.mxf.code.strategy_factory.service.impl;

import com.mxf.code.strategy_factory.request.StatisticsRequest;
import com.mxf.code.strategy_factory.response.BaseResponse;
import com.mxf.code.strategy_factory.response.FruitAvailabilityChartResponse;
import com.mxf.code.strategy_factory.response.FruitAvailabilityListResponse;
import com.mxf.code.strategy_factory.service.AnalysisTableService;
import com.mxf.code.strategy_factory.service.FruitAnalysisTableService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author mxf
 * @version 1.0
 * @description: 水果
 * @date 2023/5/26
 */
@Service("fruitAnalysisTableService")
public class FruitAnalysisTableServiceImpl implements AnalysisTableService, FruitAnalysisTableService {
    @Override
    public List<BaseResponse> getChartData(StatisticsRequest requestParams) {
        List<FruitAvailabilityChartResponse> resultList = new ArrayList<>();
        FruitAvailabilityChartResponse fruitAvailabilityChartResponse = new FruitAvailabilityChartResponse();
        fruitAvailabilityChartResponse.setXDate("2022-05-25");
        fruitAvailabilityChartResponse.setCurrentYearSalesAmount(new BigDecimal("4"));
        fruitAvailabilityChartResponse.setPreviousYearSalesAmount(new BigDecimal("5"));
        FruitAvailabilityChartResponse fruitAvailabilityChartResponse2 = new FruitAvailabilityChartResponse();
        fruitAvailabilityChartResponse2.setXDate("2022-05-26");
        fruitAvailabilityChartResponse2.setCurrentYearSalesAmount(new BigDecimal("1"));
        fruitAvailabilityChartResponse2.setPreviousYearSalesAmount(new BigDecimal("2"));
        resultList.add(fruitAvailabilityChartResponse);
        resultList.add(fruitAvailabilityChartResponse2);
        return new ArrayList<>(resultList);
    }

    @Override
    public List<BaseResponse> getListData(StatisticsRequest statisticsRequest) {
        List<FruitAvailabilityListResponse> resultList = new ArrayList<>();
        FruitAvailabilityListResponse fruitAvailabilityListResponse = new FruitAvailabilityListResponse();
        fruitAvailabilityListResponse.setXDate("");
        fruitAvailabilityListResponse.setFruitTypeName("");
        fruitAvailabilityListResponse.setSalesVolume(0.0D);
        fruitAvailabilityListResponse.setSalesAmount(new BigDecimal("0"));
        resultList.add(fruitAvailabilityListResponse);
        return new ArrayList<>(resultList);
    }

    @Override
    public Double getObtainInventory(StatisticsRequest statisticsRequest) {
        return 334423423.44;
    }
}
